import 'extended_periods.dart';

class Period {
  String? code;
  String? homeScore;
  String? awayScore;
  String? homePeriodScore;
  String? awayPeriodScore;
  ExtendedPeriods? extendedPeriods;

  Period({
    this.code,
    this.homeScore,
    this.awayScore,
    this.homePeriodScore,
    this.awayPeriodScore,
    this.extendedPeriods,
  });

  factory Period.fromJson(Map<String, dynamic> json) => Period(
        code: json['Code'] as String?,
        homeScore: json['HomeScore'] as String?,
        awayScore: json['AwayScore'] as String?,
        homePeriodScore: json['HomePeriodScore'] as String?,
        awayPeriodScore: json['AwayPeriodScore'] as String?,
        extendedPeriods: json['ExtendedPeriods'] == null
            ? null
            : ExtendedPeriods.fromJson(
                json['ExtendedPeriods'] as Map<String, dynamic>),
      );

  Map<String, dynamic> toJson() => {
        'Code': code,
        'HomeScore': homeScore,
        'AwayScore': awayScore,
        'HomePeriodScore': homePeriodScore,
        'AwayPeriodScore': awayPeriodScore,
        'ExtendedPeriods': extendedPeriods?.toJson(),
      };
}
